package kz.home.utils;

import java.util.Hashtable;

/**
 * <strong>title</strong>
 * <p> describe
 *
 * @author: Danik <br>
 * Date: 30.07.2009  <br>
 * Time: 12:41:37  <br>
 */
public class TimeLog {
    protected Hashtable table = new Hashtable();

    public void start(String processName) {
        table.put(processName, new Long(System.currentTimeMillis()));
    }

    public void stop(String processName) {
        if (table.contains(processName)) {
            table.put("f_" + processName, new Long(System.currentTimeMillis() - ((Long) table.get(processName)).longValue()));
            table.remove(processName);
        }
    }

    public void print(String processName) {
        if (table.contains("f_" + processName)) {
            System.out.println("process [" + table.get("f_" + processName) + "]");
        }
    }
}
